*************************************************************************************************
* Documentation for Reproduction of
* Intense Ambivalence. 2011. 
* Improving Public Opinion Surveys: Interdisciplinary Innovation and the American National Election Studies
* L.J Zigerell and Heather Marie Rice
* Code by L.J Zigerell
* Stata version 9
*************************************************************************************************
*************************************************************************************************
set more off
set mem 500m
* use "anes2008TS.dta", clear[This is the command to load the dataset]
* the dataset used was the 2008 ANES Time Series file
*************************************************************************************************
*************************************************************************************************

*************************************************************************************************
//* create a dummy variable coded 1 for those who received the battery version *//

tab V084402
tab V084402, mi nol
gen battery = V084402-1
tab battery, mi

*************************************************************************************************
//* post-stratification weight *//

desc V080102
clonevar weight = V080102
sum weight

*************************************************************************************************
//* traditional ANES abortion attitudes item *//
//* figure 17.3 *//

tab V085086
tab V085086 if battery==0, nol mi
clonevar ab_anes = V085086
recode ab_anes (7=.)
tab ab_anes
tab ab_anes [iw=weight]
svyset [pw=weight]
svy: proportion ab_anes 
svyset, clear

*************************************************************************************************
//* anes abortion attitudes battery *//

* fatal
clonevar ab_fatal = V085093x
tab ab_fatal
gen ab_fatal_anti = V085093x
recode ab_fatal_anti (1/6=0) (7/9=1)
tab ab_fatal_anti
gen ab_fatal_pro = V085093x
recode ab_fatal_pro (1/3=1) (4/9=0)
tab ab_fatal_pro

* rape
clonevar ab_rape = V085095x
tab ab_rape
gen ab_rape_anti = V085095x
recode ab_rape_anti (1/6=0) (7/9=1)
tab ab_rape_anti
gen ab_rape_pro = V085095x
recode ab_rape_pro (1/3=1) (4/9=0)
tab ab_rape_pro

* birth defect
clonevar ab_defect = V085096x
tab ab_defect
gen ab_defect_anti = V085096x
recode ab_defect_anti (1/6=0) (7/9=1)
tab ab_defect_anti
gen ab_defect_pro = V085096x
recode ab_defect_pro (1/3=1) (4/9=0)
tab ab_defect_pro

* health 
clonevar ab_health = V085092x
tab ab_health
gen ab_health_anti = V085092x
recode ab_health_anti (1/6=0) (7/9=1)
tab ab_health_anti
gen ab_health_pro = V085092x
recode ab_health_pro (1/3=1) (4/9=0)
tab ab_health_pro

* incest
clonevar ab_incest = V085094x
tab ab_incest
gen ab_incest_anti = V085094x
recode ab_incest_anti (1/6=0) (7/9=1)
tab ab_incest_anti
gen ab_incest_pro = V085094x
recode ab_incest_pro (1/3=1) (4/9=0)
tab ab_incest_pro

* money
clonevar ab_money = V085097x
tab ab_money
gen ab_money_anti = V085097x
recode ab_money_anti (1/6=0) (7/9=1)
tab ab_money_anti
gen ab_money_pro = V085097x
recode ab_money_pro (1/3=1) (4/9=0)
tab ab_money_pro

* sex selection
clonevar ab_gender = V085098x
tab ab_gender
gen ab_gender_anti = V085098x
recode ab_gender_anti (1/6=0) (7/9=1)
tab ab_gender_anti
gen ab_gender_pro = V085098x
recode ab_gender_pro (1/3=1) (4/9=0)
tab ab_gender_pro

* generate a variable coded 0 for those who responded to all seven scenarios
gen ab_7 = .
replace ab_7 = 0 if ab_fatal != . & ab_rape != . & ab_defect != . & ab_health != . & ab_incest != . & ab_money != . & ab_gender != .
tab ab_7

* tab those who did not respond to all seven scenarios
tab ab_7 battery, mi

* tab those who did not respond to the traditional item
tab ab_anes battery, mi

* drop battery observations if respondent did not answer all seven scenarios
drop if battery == 1 & ab_7 !=0

*************************************************************************************************
//* figure 17.2 *//
* unweighted

tab ab_fatal
tab ab_rape
tab ab_defect
tab ab_health
tab ab_incest
tab ab_money
tab ab_gender

* weighted 

tab ab_fatal [iw=weight]
tab ab_rape [iw=weight]
tab ab_defect [iw=weight]
tab ab_health [iw=weight]
tab ab_incest [iw=weight]
tab ab_money [iw=weight]
tab ab_gender [iw=weight]

* weighted (alternate method)

svyset [pw=weight]
svy: proportion ab_fatal
svy: proportion ab_rape
svy: proportion ab_defect
svy: proportion ab_health
svy: proportion ab_incest
svy: proportion ab_money
svy: proportion ab_gender
svyset, clear

*************************************************************************************************
* generate a variable coded from -7 to +7 for the directional battery prong

gen ab_count = ab_7
tab ab_count
replace ab_count = ab_count + 1 if ab_fatal == 1
replace ab_count = ab_count + 1 if ab_fatal == 2
replace ab_count = ab_count + 1 if ab_fatal == 3
replace ab_count = ab_count - 1 if ab_fatal == 7
replace ab_count = ab_count - 1 if ab_fatal == 8
replace ab_count = ab_count - 1 if ab_fatal == 9

replace ab_count = ab_count + 1 if ab_rape == 1
replace ab_count = ab_count + 1 if ab_rape == 2
replace ab_count = ab_count + 1 if ab_rape == 3
replace ab_count = ab_count - 1 if ab_rape == 7
replace ab_count = ab_count - 1 if ab_rape == 8
replace ab_count = ab_count - 1 if ab_rape == 9

replace ab_count = ab_count + 1 if ab_defect == 1
replace ab_count = ab_count + 1 if ab_defect == 2
replace ab_count = ab_count + 1 if ab_defect == 3
replace ab_count = ab_count - 1 if ab_defect == 7
replace ab_count = ab_count - 1 if ab_defect == 8
replace ab_count = ab_count - 1 if ab_defect == 9

replace ab_count = ab_count + 1 if ab_incest == 1
replace ab_count = ab_count + 1 if ab_incest == 2
replace ab_count = ab_count + 1 if ab_incest == 3
replace ab_count = ab_count - 1 if ab_incest == 7
replace ab_count = ab_count - 1 if ab_incest == 8
replace ab_count = ab_count - 1 if ab_incest == 9

replace ab_count = ab_count + 1 if ab_health == 1
replace ab_count = ab_count + 1 if ab_health == 2
replace ab_count = ab_count + 1 if ab_health == 3
replace ab_count = ab_count - 1 if ab_health == 7
replace ab_count = ab_count - 1 if ab_health == 8
replace ab_count = ab_count - 1 if ab_health == 9

replace ab_count = ab_count + 1 if ab_money == 1
replace ab_count = ab_count + 1 if ab_money == 2
replace ab_count = ab_count + 1 if ab_money == 3
replace ab_count = ab_count - 1 if ab_money == 7
replace ab_count = ab_count - 1 if ab_money == 8
replace ab_count = ab_count - 1 if ab_money == 9

replace ab_count = ab_count + 1 if ab_gender == 1
replace ab_count = ab_count + 1 if ab_gender == 2
replace ab_count = ab_count + 1 if ab_gender == 3
replace ab_count = ab_count - 1 if ab_gender == 7
replace ab_count = ab_count - 1 if ab_gender == 8
replace ab_count = ab_count - 1 if ab_gender == 9

//* figure 17.4 *//

tab ab_count
tab ab_count [iw=weight]
svyset [pw=weight]
svy: proportion ab_count
svyset, clear

*************************************************************************************************
* generate a variable coded from -7 to -63 for the directional and intensity battery prongs

tab ab_7
gen ab_index = ab_7
replace ab_index = ab_fatal + ab_rape + ab_defect + ab_health + ab_incest + ab_money + ab_gender
replace ab_index = -1 * ab_index
tab ab_index

pwcorr ab_anes ab_count ab_index, sig obs

*************************************************************************************************
* generate a variable for those who oppose abortion in all seven scenarios

gen ab_all_anti = ab_7
tab ab_all_anti
replace ab_all_anti = 1 if ab_fatal_anti == 1 & ab_rape_anti == 1 & ab_defect_anti == 1 & ab_health_anti == 1 & ab_incest_anti == 1 & ab_money_anti == 1 & ab_gender_anti == 1
tab ab_all_anti
tab ab_all_anti [iw=weight]
svyset [pw=weight]
svy: proportion ab_all_anti
svyset, clear

*************************************************************************************************
* generate a variable for those who favor abortion in all seven scenarios

gen ab_all_pro = ab_7
tab ab_all_pro
replace ab_all_pro = 1 if ab_fatal_pro == 1 & ab_rape_pro == 1 & ab_defect_pro == 1 & ab_health_pro == 1 & ab_incest_pro == 1 & ab_money_pro == 1 & ab_gender_pro == 1
tab ab_all_pro
tab ab_all_pro [iw=weight]
svyset [pw=weight]
svy: proportion ab_all_pro
svyset, clear

*************************************************************************************************
//* polarized ambivalence *//

gen amb_fatal_gender = ab_7
replace amb_fatal_gender = 1 if ab_fatal_pro == 1 & ab_gender_anti == 1
tab amb_fatal_gender
tab amb_fatal_gender [iw=weight]

gen amb_fatal_gender_strong = ab_7
replace amb_fatal_gender_strong = 1 if ab_fatal == 1 & ab_gender == 9
tab amb_fatal_gender_strong
tab amb_fatal_gender_strong [iw=weight]

//* rape incest life *//

gen amb_incest_rape = ab_7
replace amb_incest_rape = 1 if ab_incest_pro == 1 & ab_rape_anti == 1
tab amb_incest_rape
tab amb_incest_rape [iw=weight]

gen amb_rape_incest = ab_7
replace amb_rape_incest = 1 if ab_incest_anti == 1 & ab_rape_pro == 1
tab amb_rape_incest
tab amb_rape_incest [iw=weight]

ttest ab_rape = ab_incest, unp une

gen amb_fatal_health = ab_7
replace amb_fatal_health = 1 if ab_fatal_pro == 1 & ab_incest_anti == 1
replace amb_fatal_health = 1 if ab_fatal_anti == 1 & ab_incest_pro == 1
tab amb_fatal_health
tab amb_fatal_health [iw=weight]

*************************************************************************************************
//* abortion absolutism *//
//* traditional anes abortion attitudes item: absolutists *//

gen ab_anes_anti = ab_anes
recode ab_anes_anti (2/4=0)
tab ab_anes_anti
tab ab_anes_anti [iw=weight]
svyset [pw=weight]
svy: proportion ab_anes_anti
svyset, clear

gen ab_anes_pro = ab_anes
recode ab_anes_pro (4=1) (1/3=0)
tab ab_anes_pro
tab ab_anes_pro [iw=weight]
svyset [pw=weight]
svy: proportion ab_anes_pro
svyset, clear

*************************************************************************************************
* t-tests comparing absolutists in battery to absolutists in the traditional item

* unweighted t-test
ttest ab_all_pro = ab_anes_pro, unp une
ttest ab_all_anti = ab_anes_anti, unp une

* weighted t-test
gen sum_pro = 0
replace sum_pro = 1 if ab_all_pro == 1 | ab_anes_pro == 1
reg sum_pro battery [pw=weight]

gen sum_anti = 0
replace sum_anti = 1 if ab_all_anti == 1 | ab_anes_anti == 1
reg sum_anti battery [pw=weight]

*************************************************************************************************
//* abortion timing *//
* see 2006 data
*************************************************************************************************

*************************************************************************************************
//* regression: predicting abortion attitudes *//

*gender
tab V081101
gen female = V081101
replace female = female - 1
tab female if battery == 1

* race
tab V081102
gen white = V081102
recode white (1/7=0)
gen black = V081102
recode black (1/7=0)
replace white = 1 if V081102 == 1
replace black = 1 if V081102 == 2
tab white if battery == 1
tab black if battery == 1

* latino
tab V081103
gen latino = V081103
recode latino (2=0)
tab latino if battery == 1

* age
clonevar age = V083215x
tab age if battery == 1
summ age if battery == 1
z1 age /* Note: the z1 command is a shortcut command that recodes a variable to range from 0 to 1. See accompanying do file */
summ z_age if battery == 1

* education
clonevar educ = V083217
tab educ if battery == 1
summ educ if battery == 1
z1 educ /* Note: the z1 command is a shortcut command that recodes a variable to range from 0 to 1. See accompanying do file */
summ z_educ if battery == 1

* income
clonevar income = V083249
tab income if battery == 1
summ income if battery == 1, de
z1 income /* Note: the z1 command is a shortcut command that recodes a variable to range from 0 to 1. See accompanying do file */
summ z_income if battery == 1

* religious services attendance
tab V083185
tab V083186
gen att = .
replace att = 0 if V083185 == 5
replace att = 0 if V083186 == 5
replace att = 1 if V083186 == 4
replace att = 2 if V083186 == 3
replace att = 3 if V083186 == 2
replace att = 4 if V083186 == 1
tab att if battery == 1
summ att if battery == 1
z1 att /* Note: the z1 command is a shortcut command that recodes a variable to range from 0 to 1. See accompanying do file */
summ z_att if battery == 1

* bible
tab V083184
gen bible = V083184
recode bible (7=.)
replace bible = 4 - bible
tab bible if battery == 1
gen bible_lit = bible
recode bible_lit (3=1) (1 2=0)
gen bible_insp = bible
recode bible_insp (2=1) (1 3=0)
tab bible_lit if battery == 1
tab bible_insp if battery == 1

* political party
tab V083097
gen gop3 = V083097
recode gop3 (1=0) (3/5=1)
tab gop3
gen rep = V083097
gen dem = V083097
gen ind = V083097
recode rep (2=1) (1 3/5=0)
recode dem (2/5=0)
recode ind (1/2=0) (3/5=1)
tab rep if battery == 1
tab dem if battery == 1
tab ind if battery == 1

*************************************************************************************************
//* table 17.2 *//

gen ab_anes14 = 14*(ab_anes-1)/3
gen ab_count14 = ab_count + 7
gen ab_index14 = 14*(ab_index+63)/56

summ ab_anes14 ab_count14 ab_index14

summ female black latino z_age z_educ z_income z_att bible_lit bible_insp rep dem

reg ab_anes14 female black latino z_age z_educ z_income z_att bible_lit bible_insp rep dem 
reg ab_anes14 female black latino z_age z_educ z_income z_att bible_lit bible_insp rep dem [pw=weight] /* Table 17.2 column 1 */

reg ab_count14 female black latino z_age z_educ z_income z_att bible_lit bible_insp rep dem 
reg ab_count14 female black latino z_age z_educ z_income z_att bible_lit bible_insp rep dem [pw=weight] /* Table 17.2 column 2 */

reg ab_index14 female black latino z_age z_educ z_income z_att bible_lit bible_insp rep dem 
reg ab_index14 female black latino z_age z_educ z_income z_att bible_lit bible_insp rep dem [pw=weight] /* Table 17.2 column 3 */

*************************************************************************************************
//* regressions: predicting vote choice *//

* 2008 vote choice
tab V085195
gen obama = V085195
recode obama (3=0) (7=.)
tab obama if battery == 1
gen mccain = V085195
recode mccain (1=0) (3=1) (7=.)
tab mccain if battery == 1

tab V085195 if black==1

* south
tab V081201a
gen south = .
replace south = 1 if V081201a == "AL"
replace south = 1 if V081201a == "FL"
replace south = 1 if V081201a == "GA"
replace south = 1 if V081201a == "LA"
replace south = 1 if V081201a == "MS"
replace south = 1 if V081201a == "NC"
replace south = 1 if V081201a == "SC"
replace south = 1 if V081201a == "TN"
replace south = 1 if V081201a == "TX"
replace south = 1 if V081201a == "VA"
replace south = 0 if V081201a == "AZ"
replace south = 0 if V081201a == "CA"
replace south = 0 if V081201a == "CO"
replace south = 0 if V081201a == "CT"
replace south = 0 if V081201a == "DC"
replace south = 0 if V081201a == "DE"
replace south = 0 if V081201a == "IL"
replace south = 0 if V081201a == "IN"
replace south = 0 if V081201a == "KS"
replace south = 0 if V081201a == "MA"
replace south = 0 if V081201a == "MI"
replace south = 0 if V081201a == "MN"
replace south = 0 if V081201a == "ND"
replace south = 0 if V081201a == "NJ"
replace south = 0 if V081201a == "NM"
replace south = 0 if V081201a == "NV"
replace south = 0 if V081201a == "NY"
replace south = 0 if V081201a == "OH"
replace south = 0 if V081201a == "OK"
replace south = 0 if V081201a == "OR"
replace south = 0 if V081201a == "PA"
replace south = 0 if V081201a == "RI"
replace south = 0 if V081201a == "WA"
replace south = 0 if V081201a == "WI"
tab south if battery == 1
tab V081201a if south == 1
tab V081201a if south == 0

* own gun
tab V083165
gen owngun = V083165
recode owngun (5=0)
tab owngun if battery == 1

pwcorr obama ab_anes ab_count ab_index, sig obs

*************************************************************************************************
//* table 3 *//

z1 ab_anes ab_count ab_index /* Note: the z1 command is a shortcut command that recodes a variable to range from 0 to 1. See accompanying do file */
summ z_ab_anes z_ab_count z_ab_index

logit obama z_ab_anes female latino z_age z_educ z_income z_att rep dem south owngun if black != 1
logit obama z_ab_anes female latino z_age z_educ z_income z_att rep dem south owngun if black != 1 [pw=weight] /* Table 17.3 column 2 */
precalc

logit obama z_ab_count female latino z_age z_educ z_income z_att rep dem south owngun if black != 1
logit obama z_ab_count female latino z_age z_educ z_income z_att rep dem south owngun if black != 1 [pw=weight] /* Table 17.3 column 2 */
precalc

logit obama z_ab_index female latino z_age z_educ z_income z_att rep dem south owngun if black != 1
logit obama z_ab_index female latino z_age z_educ z_income z_att rep dem south owngun if black != 1 [pw=weight] /* Table 17.3 column 3 */
precalc

egen std_ab_anes = std(ab_anes)
egen std_ab_count = std(ab_count)
egen std_ab_index = std(ab_index)

summ std_ab_anes std_ab_count std_ab_index

logit obama std_ab_anes female latino z_age z_educ z_income z_att rep dem south owngun if black != 1
logit obama std_ab_anes female latino z_age z_educ z_income z_att rep dem south owngun if black != 1 [pw=weight]

logit obama std_ab_count female latino z_age z_educ z_income z_att rep dem south owngun if black != 1
logit obama std_ab_count female latino z_age z_educ z_income z_att rep dem south owngun if black != 1 [pw=weight]

logit obama std_ab_index female latino z_age z_educ z_income z_att rep dem south owngun if black != 1
logit obama std_ab_index female latino z_age z_educ z_income z_att rep dem south owngun if black != 1 [pw=weight]

*************************************************************************************************
//* these are respondents who switched from favor to oppose on at least one condition *//

gen context = ab_7
tab context
recode context (0=1) if ab_fatal_anti == 1 & ab_rape_pro == 1
recode context (0=1) if ab_fatal_pro == 1 & ab_rape_anti == 1

recode context (0=1) if ab_fatal_anti == 1 & ab_defect_pro == 1
recode context (0=1) if ab_fatal_pro == 1 & ab_defect_anti == 1

recode context (0=1) if ab_fatal_anti == 1 & ab_health_pro == 1
recode context (0=1) if ab_fatal_pro == 1 & ab_health_anti == 1

recode context (0=1) if ab_fatal_anti == 1 & ab_incest_pro == 1
recode context (0=1) if ab_fatal_pro == 1 & ab_incest_anti == 1

recode context (0=1) if ab_fatal_anti == 1 & ab_money_pro == 1
recode context (0=1) if ab_fatal_pro == 1 & ab_money_anti == 1

recode context (0=1) if ab_fatal_anti == 1 & ab_gender_pro == 1
recode context (0=1) if ab_fatal_pro == 1 & ab_gender_anti == 1

*

recode context (0=1) if ab_rape_anti == 1 & ab_defect_pro == 1
recode context (0=1) if ab_rape_pro == 1 & ab_defect_anti == 1

recode context (0=1) if ab_rape_anti == 1 & ab_health_pro == 1
recode context (0=1) if ab_rape_pro == 1 & ab_health_anti == 1

recode context (0=1) if ab_rape_anti == 1 & ab_incest_pro == 1
recode context (0=1) if ab_rape_pro == 1 & ab_incest_anti == 1

recode context (0=1) if ab_rape_anti == 1 & ab_money_pro == 1
recode context (0=1) if ab_rape_pro == 1 & ab_money_anti == 1

recode context (0=1) if ab_rape_anti == 1 & ab_gender_pro == 1
recode context (0=1) if ab_rape_pro == 1 & ab_gender_anti == 1

*

recode context (0=1) if ab_defect_anti == 1 & ab_health_pro == 1
recode context (0=1) if ab_defect_pro == 1 & ab_health_anti == 1

recode context (0=1) if ab_defect_anti == 1 & ab_incest_pro == 1
recode context (0=1) if ab_defect_pro == 1 & ab_incest_anti == 1

recode context (0=1) if ab_defect_anti == 1 & ab_money_pro == 1
recode context (0=1) if ab_defect_pro == 1 & ab_money_anti == 1

recode context (0=1) if ab_defect_anti == 1 & ab_gender_pro == 1
recode context (0=1) if ab_defect_pro == 1 & ab_gender_anti == 1

*

recode context (0=1) if ab_defect_anti == 1 & ab_incest_pro == 1
recode context (0=1) if ab_defect_pro == 1 & ab_incest_anti == 1

recode context (0=1) if ab_defect_anti == 1 & ab_money_pro == 1
recode context (0=1) if ab_defect_pro == 1 & ab_money_anti == 1

recode context (0=1) if ab_defect_anti == 1 & ab_gender_pro == 1
recode context (0=1) if ab_defect_pro == 1 & ab_gender_anti == 1

*

recode context (0=1) if ab_incest_anti == 1 & ab_money_pro == 1
recode context (0=1) if ab_incest_pro == 1 & ab_money_anti == 1

recode context (0=1) if ab_incest_anti == 1 & ab_gender_pro == 1
recode context (0=1) if ab_incest_pro == 1 & ab_gender_anti == 1

*

recode context (0=1) if ab_money_anti == 1 & ab_gender_pro == 1
recode context (0=1) if ab_money_anti == 1 & ab_gender_pro == 1

tab context
tab context [iw=weight]

gen polar = ab_7
tab ab_7
replace polar = 1 if ab_fatal_pro == 1 & ab_rape_pro == 1 & ab_money_anti == 1 & ab_gender_anti == 1
tab polar [iw=weight]

*************************************************************************************************
